refactor: Reference top-level settings instead of FEATURES#38095
Draft
kdmccormick wants to merge 13 commits intoopenedx:masterfrom
Draft
refactor: Reference top-level settings instead of FEATURES#38095kdmccormick wants to merge 13 commits intoopenedx:masterfrom
kdmccormick wants to merge 13 commits intoopenedx:masterfrom
Conversation
It was referenced before both as a regular Django setting (via the deprecated FEATURES dict) and as a SettingToggle. Picking one makes the FEATURES refactoring easier. We picked regular Django setting, because there is non-cms code which needs to query this setting, so a SettingToggle defined in cms/djangoapps/contentstore is not viable.
The pattern `settings.FEATURES.get('FOO')` is deprecated in favor
of `settings.FOO`. The latter pattern is stricter: it will raise an
AttributeError if the settings is missing rather than silently returning
None (e.g., False).
In order to move to the stricter pattern, we must move several settings'
from variant-specific config at (lms,cms)/envs/common.py up into
shared config at openedx/envs/common.py. That way, when the setting
is referenced in the other service variant, it does not AttributeError.
These settings all have falsy defaults, so we are not changing any
application logic by defining them with these defaults.
With this change, every call to `settings.FEATURES.get('FOO')` now
has a matching common setting definition, we we can call
`settings.FOO` without raising an AttributeError on non-overridden
settings.
8d05b2a to
8e243dc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
WIP
Replace each reference to the FEATURES dictionary with the equivalent top-level Django settings reference.
Supporting information
TBC
Testing instructions
TBC
Deadline
Verawood code freeze
Other information
AI notes
I used claude code -- more TBC